import { defineStore } from 'pinia'
import { ref } from 'vue'

// 这里是开启多轮对话的关键，其实就是保留每次的对话，会造成token爆炸，需要限定长度
export const useToTalks = defineStore('counter', () => {
  const length = ref(0)
  const talk = ref<any[]>([])
  function addTake(msg: any) {
    length.value++
    if (length.value < 10) {
      talk.value.push(msg)
    }
  }
  function restart(){
    talk.value = []
  }
  return { length, talk, addTake, restart }
})

export const engineSwitch = defineStore('switch', () => {
  let switchList: { [key: string]: boolean } = {
    "baidu": true,
    "google": true,
    "bing": true,
    "sougou": true,
    "360": true,
    "scholar": true,
    "yahoo": true,
    "duckduckgo": true,
  };
  return { switchList };
});
